const { collections } = require("../db/mongo_conf");
const {
    insertOne,
    deleteOne,
    updateOne,
    getAllData,
} = require("../db/mongo_util");

function addChannel(data) {
    return insertOne(collections.channel, data);
}

function deleteChannel(whereOption) {
    return deleteOne(collections.channel, whereOption);
}

function updateChannel(whereOption, data) {
    delete data._id;
    return updateOne(collections.channel, whereOption, data);
}

function getAllChannels() {
    return getAllData(collections.channel);
}

module.exports = {
    addChannel,
    deleteChannel,
    updateChannel,
    getAllChannels,
};
